﻿// RegisterDialog.cpp: 实现文件
//

#include "stdafx.h"
#include "MFCApplication1.h"
#include "RegisterDialog.h"
#include "afxdialogex.h"
#include "../MFCLibrary1/RegisterAPI.h"

// RegisterDialog 对话框

IMPLEMENT_DYNAMIC(RegisterDialog, CDialogEx)

RegisterDialog::RegisterDialog(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_REGISTERDIALOG, pParent)
{

}

RegisterDialog::~RegisterDialog()
{
}

void RegisterDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_REGISTERCODE, m_registercode);
}


BEGIN_MESSAGE_MAP(RegisterDialog, CDialogEx)
	ON_BN_CLICKED(IDOK, &RegisterDialog::OnBnClickedOk)
END_MESSAGE_MAP()


// RegisterDialog 消息处理程序


void RegisterDialog::OnBnClickedOk()
{
	// TODO: 在此添加控件通知处理程序代码
	CDialogEx::OnOK();
	//Register::reg_registed();
	//控件内容下载
	UpdateData(TRUE);
	CString registercode;
	m_registercode.GetWindowTextW(registercode);
	long datetime = _ttoi(registercode);
	bool retval;
	if (datetime>0) {
		retval = Register::setupRegRegister(datetime);
	}
	else {
		AfxMessageBox(_T("请填写全数字序列号"));
	}
	
	//Register::setupRegRegister(1);
	//Register::setupRegRegister();
	//已注册
}
